package judesart.app.client;

import judesart.app.client.ui.pub.layout.PublicMainLayout;

import com.allen_sauer.gwt.log.client.Log;
import com.extjs.gxt.ui.client.GXT;
import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.DeferredCommand;
import com.google.gwt.user.client.ui.RootPanel;

public class PublicApp implements EntryPoint {
    /**
     */
    public void onModuleLoad() {
    	ApplicationProperties.init();
        Log.setUncaughtExceptionHandler();

        DeferredCommand.addCommand(new Command() {
            @Override
            public void execute() {
                onModuleLoad2();
            }
        });
    }

    /**
     * This is the entry point method.
     * 
     * @wbp.parser.entryPoint
     */
    public void onModuleLoad2() {
        PublicMainLayout mainPanel = PublicMainLayout.getInstance();
        // mainPanel.setStyleAttribute("margin", "0 auto");
        // mainPanel.setStyleAttribute("overflow", "auto");
        // mainPanel.setWidth(960);
        mainPanel.setHeight("100%");
        if (GXT.isChrome)
            mainPanel.addStyleName("chrome");
        else if (GXT.isIE)
            mainPanel.addStyleName("ie");

        RootPanel.get().add(mainPanel);
        mainPanel.layout();
        
        Log.debug("STARTED - init? : [" + ApplicationProperties.isInitialized() + "]");
        Log.debug("STARTED - prod : [" + ApplicationProperties.isProduction() + "]");
        Log.debug("STARTED - version : [" + ApplicationProperties.getVersion() + "]");
    }
}
